package cn.xz.zysjz.adapter;

import android.view.View;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.appcompat.widget.LinearLayoutCompat;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import cn.xz.zysjz.R;
import cn.xz.zysjz.activity.KfActivity;
import cn.xz.zysjz.bean.IndexBean;
import cn.xz.zysjz.utils.AppHelper;

/**
 * 疫苗详情列表适配器*/
public class IndexListAdapter extends BaseQuickAdapter<IndexBean, BaseViewHolder> {

    public IndexListAdapter(int layoutResId) {
        super(layoutResId);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, IndexBean mListBean) {
        //地点
        TextView tvAd = helper.getView(R.id.tv_ad);
        //联系电话
        TextView tvPhone = helper.getView(R.id.tv_phone);
        //负责人
        TextView tvName = helper.getView(R.id.tv_name);
        //库存
        TextView tvK = helper.getView(R.id.tv_k);
        //联系
        LinearLayoutCompat llcLx = helper.getView(R.id.llc_lx);

        tvAd.setText("接种地址: " + mListBean.getAddress());
        tvPhone.setText("联系电话: " + mListBean.getPhone());
        tvName.setText("负责人: " + mListBean.getName());
        tvK.setText("当前库存: " + mListBean.getNumber() + " 针/人");

        llcLx.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //跳转到在线联系
                AppHelper.toJump(KfActivity.class,mListBean.getName());
            }
        });

    }
}
